#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;
    int ret = 0;
    for (int i = 1; i <= n; i++)
    {
        set<int> st;
        for (int p = 1; p < i; p++)
        {
            if (i % p == 0)
            {
                st.insert(p);
            }
        }
        int sum = 0;
        for (auto s : st)
        {
            sum += s;
        }
        if (sum == i)
        {
            ret++;
        }
    }
    cout << ret << endl;
    return 0;
}

class Solution {
public:
    struct kcCom
    {
        bool operator()(const pair<string, int>& lsh, const pair<string, int>& rsh)
        {
            return lsh.second > rsh.second;
        }
    };
    vector<string> topKFrequent(vector<string>& words, int k) {
        map<string, int> ret;
        for (auto& s : words)
        {
            ret[s]++;
        }
        vector<pair<string, int>> v(ret.begin(), ret.end());
        stable_sort(v.begin(), v.end(), kcCom());
        vector<string> r;
        vector<pair<string, int>>::iterator it = v.begin();
        while (k--)
        {
            r.push_back((it)->first);
            it++;
        }
        return r;
    }
};

struct kvCom
{
    bool operator()(const pair<string, int>& lsh, const pair<string, int>& rsh)
    {
        if (lsh.second > rsh.second)
        {
            return true;
        }
        else if (lsh.second < rsh.second)
        {
            return false;
        }
        else
        {
            return lsh.first > rsh.first;
        }
    }
};

int main() {
    string str;
    getline(cin, str);
    map<string, int> m;
    transform(str.begin(), str.end(), str.begin(), ::tolower);
    int n = str.size();
    for (int slow = 0, fast = 0; fast < n; fast++)
    {
        if (str[fast] == ' ' || str[fast] == '.')
        {
            string s = str.substr(slow, fast - slow);
            slow = fast + 1;
            m[s]++;
        }
    }
    vector<pair<string, int>> ret;
    for (auto s : m)
    {
        ret.push_back(s);
    }
    sort(ret.begin(), ret.end(), kvCom());
    for (auto s : m)
    {
        cout << s.first << ":" << s.second << endl;
    }
    return 0;
}